<!--
 * @Author: your name
 * @Date: 2022-01-13 09:56:19
 * @LastEditTime: 2022-01-13 10:23:10
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \0113\弹性布局.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>弹性布局</title>
    <style>
        *{
            margin: 0;
            padding: 0;
            border: 0 none;
        }
        ul{
            width: 1200px;
            height: 500px;
            background: violet;
            margin: 0 auto;
            border: 2px double black;
            /*转化为弹性布局*/
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            justify-content: space-around;
            align-items: flex-start;
            align-content: space-around;
        }
        ul li{
            width: 100px;
            height: 100px;
            background: white;
            list-style: none;
            /*文字水平居中*/
            text-align: center;
            /*设置行号等于高度的时候文字垂直居中*/
            line-height: 50px;
        }
        ul li:nth-child(1){
            flex-grow: 0.5;
        }
        ul li:nth-child(2){
            flex-grow: 1;
        }
        ul li:nth-child(3){
            flex-grow: 1.5;
        }
        ul li:nth-child(4){
            align-self: flex-start;
        }
    </style>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
</body>
</html>
